package com.youth.koodoReaderManager.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;

@Data // Lombok注解，生成getter、setter等方法
@Accessors(chain = true) // Lombok注解，支持链式调用
@TableName("koodo_html_book") // MyBatis Plus注解，指定映射的数据库表名
public class HtmlBook {
    @TableId(value = "key", type = IdType.AUTO) // MyBatis Plus注解，指定主键字段和生成策略
    @ApiModelProperty(value = "HTML书籍的唯一键", required = true) // Swagger注解，描述字段
    private Integer key;

    @ApiModelProperty(value = "章节列表") // Swagger注解，描述字段
    private List<Chapter> chapters;

    @ApiModelProperty(value = "扁平化的章节列表") // Swagger注解，描述字段
    private List<FlatChapter> flattenChapters;

    @ApiModelProperty(value = "书籍呈现信息") // Swagger注解，描述字段
    private Object rendition; // 由于rendition的具体类型未知，使用Object类型

    // 章节类
    public static class Chapter {
        @ApiModelProperty(value = "章节标签")
        private String label;

        @ApiModelProperty(value = "章节ID")
        private Integer id;

        @ApiModelProperty(value = "章节链接")
        private String href;

        @ApiModelProperty(value = "章节索引")
        private Integer index;

        // 构造函数、getter和setter方法 (由Lombok自动生成)
    }

    // 扁平化章节类
    public static class FlatChapter {
        @ApiModelProperty(value = "章节标签")
        private String label;

        @ApiModelProperty(value = "章节ID")
        private Integer id;

        @ApiModelProperty(value = "章节链接")
        private String href;

        @ApiModelProperty(value = "章节索引")
        private Integer index;

        // 构造函数、getter和setter方法 (由Lombok自动生成)
    }

    public HtmlBook(Integer key, List<Chapter> chapters, List<FlatChapter> flattenChapters, Object rendition) {
        this.key = key;
        this.chapters = chapters;
        this.flattenChapters = flattenChapters;
        this.rendition = rendition;
    }

    // 构造函数、getter和setter方法 (由Lombok的@Data注解自动生成)
}